/* GUI CONVERTED from rcscmtc.p (converter v1.75) Sat Aug 12 23:01:32 2000 */
/* rcscmtc.p - Release Management Customer Schedules                    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*V8:ConvertMode=Maintenance                                            */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 8.6    LAST MODIFIED: 09/20/96           BY: TSI *K005*         */
/* REVISION: 8.6    LAST MODIFIED: 01/27/97           BY: kxn *K057*         */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98           BY: *K1Q4* Alfred Tan  */
/* REVISION: 8.6    LAST MODIFIED: 09/03/99           BY: *K22K* Reetu Kapoor*/
/* REVISION: 9.1    LAST MODIFIED: 08/12/00           BY: *N0KP* myb         */


         /* SCHEDULE DETAIL MAINT SUBPROGRAM */


         {mfdeclre.i}


         /*INPUT PARAMETERS*/
         define input parameter schddet_recid as recid no-undo.

         /*OUTPUT PARAMETERS*/
         define output parameter undo_status as logical no-undo.

         /*LOCAL VARIABLES*/
         define variable errlevel as integer no-undo.


         find schd_det
            where recid(schd_det) = schddet_recid
            no-lock.

/*K057*/ if schd_type > 3 then do:
/*K057*/     undo_status = false.
/*K057*/     return.
/*K057*/ end.

         find so_mstr
            where so_nbr = schd_nbr
/*K057*     no-lock.                   */
/*K057*/    no-lock no-error.
/*K057*/    if not available so_mstr then do:
/*K057*/       {mfmsg.i 609 3}  /* SALES ORDER DOES NOT EXIST */
/*K057*/       undo_status = true.
/*K057*/       return.
/*K057*/    end.

         undo_status = false.

         if schd_ship_qty > 0
            or schd_all_qty > 0 then
/*K22K*/ do:

/*K22K*/    for first scx_ref
/*K22K*/       fields (scx_line scx_order scx_shipfrom scx_type)
/*K22K*/       where scx_type  = 1
/*K22K*/         and scx_order = schd_nbr
/*K22K*/         and scx_line  = schd_line no-lock:
/*K22K*/    end. /* FOR FIRST SCX_REF */

/*K22K**    find first absr_det                   */
/*K22K**       where absr_type      = schd_type   */

/*K22K*/    for first absr_det
/*K22K*/       fields (absr_date absr_interval absr_line absr_nbr
/*K22K*/               absr_reference absr_rlse_id absr_shipfrom
/*K22K*/               absr_ship_id absr_time absr_type)
/*K22K*/       where absr_shipfrom  = scx_shipfrom
/*K22K*/         and absr_type      = schd_type
                 and absr_nbr       = schd_nbr
                 and absr_line      = schd_line
                 and absr_rlse_id   = schd_rlse_id
                 and absr_date      = schd_date
                 and absr_time      = schd_time
                 and absr_interval  = schd_interval
                 and absr_ref       = schd_reference
/*K22K**       no-lock no-error.                 */
/*K22K*/       no-lock:
/*K22K*/    end.   /* FOR FIRST ABSR_DET */
/*K22K*/ end.  /* IF SCHD_SHIP_QTY > 0 ... */
         else
            return.

         {gprun.i ""gpcfmsg.p"" "(input 1512,
                                  input 0,
                                  input program-name(1),
                                  input so_site,
                                  input so_ship,
                                  input '',
                                  input false,
                                  output errlevel)"}
/*GUI*/ if global-beam-me-up then undo, leave.


         if schd_ship_qty > 0
            and errlevel > 0 then
         do:
            if available absr_det then
            do:
               {mfmsg03.i 1512 errlevel "absr_ship_id" """" """"}
            end.
            else
            do:
               {mfmsg03.i 1512 errlevel """" """" """"}
            end.
            pause.

            undo_status = if errlevel > 2
                             then true else undo_status.

            if undo_status then
               return.

         end.


         {gprun.i ""gpcfmsg.p"" "(input 1513,
                                  input 0,
                                  input program-name(1),
                                  input so_site,
                                  input so_ship,
                                  input '',
                                  input false,
                                  output errlevel)"}
/*GUI*/ if global-beam-me-up then undo, leave.


         if schd_all_qty > 0
            and errlevel > 0 then
         do:
            if available absr_det then
            do:
               {mfmsg03.i 1513 errlevel "absr_ship_id" """" """"}
            end.
            else
            do:
               {mfmsg03.i 1513 errlevel """" """" """"}
            end.
            pause.

            undo_status = if errlevel > 2
                             then true else undo_status.

         end.
